package com.itcast.mallweb.controller;


import com.itcast.admin.dto.OrderDTO;
import com.itcast.admin.vo.DityVO;
import com.itcast.admin.vo.OrderAllVO;
import com.itcast.mallweb.service.OrderService;
import com.itcast.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/order")
@Slf4j
@Api(tags = "web-订单相关接口")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/queryAll")
    @ApiOperation("查询全部订单")
    public Result<List<OrderAllVO>> orderQueryAll() {
        List<OrderAllVO> orderAllVO = orderService.orderQueryAll();
        return Result.success(orderAllVO);
    }

    @PostMapping("/amend")
    @ApiOperation("修改订单状态")
    public Result orderAmend(@RequestBody OrderDTO orderDTO) {
        log.info("修改订单状态为{}",orderDTO);
        orderService.orderAmend(orderDTO);
        return Result.success();
    }





}
